package com.example.demo.lianxi;


import com.example.demo.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;



@Controller
public class ClientController {


    @RequestMapping(value = "/doGetControllerOne", method = RequestMethod.POST)
    @ResponseBody
    public String doGetControllerOne(){

        return "无参请求";
    }

    @RequestMapping("/doGetControllerTwo")
    @ResponseBody
    public String doGetControllerTwo(String name, Integer age){

        return "你的名字叫：" + name + ",年龄是：" + age;
    }

    @RequestMapping(value = "/doPostControllerThree", method = RequestMethod.POST)
    @ResponseBody
    public String doPostControllerThree(@RequestBody User user){

        return user.toString();
    }

    @RequestMapping(value = "/doPostControllerFour", method = RequestMethod.POST)
    @ResponseBody
    public String doPostControllerFour(@RequestBody User user, Integer flag, String meaning){

        return user.toString() + "\n" + flag + ">>>" + meaning;
    }

}
